home *** CD-ROM | disk | FTP | other *** search
/ Invisible Universe / Invisible Universe (1995)(Voyager)[Mac-PC].iso / mac / MOVIES / MIAWS / _NAV.DIR / 00005_Script_popup stuff < prev    next >
Text File  |  1995-11-13  |  8KB  |  302 lines

  1. on setView theViews, theType
  2.   
  3.   global gNavType,gNavViews,gNavViewSelect
  4.   
  5.   --  theType is Visible,Radio,Microwave,Hydrogen,Infrared
  6.   -- otherwise theViews is used to determine theType
  7.   -- theViews is a property list where the property is the label name
  8.   -- and the value is the full name of the view: GANDV:"Andromeda Galaxy (Visible)"
  9.   -- VIEWV,VIEWR,VIEWM,VIEWH,VIEWI,VIEW2,VIEW3,VIEW4,VIEW5,VIEW6,VIEW7
  10.   
  11.   put empty into gNavViews
  12.   
  13.   if voidP(theType) then --multiple views 
  14.     
  15.     --put ">>> setView in _Nav (view)" & theViews
  16.     
  17.     put "VIEW"&string(count(theViews)) into gNavType
  18.     put theViews into gNavViews
  19.     setViewPopUp
  20.   else 
  21.     --put ">>> setView in _Nav (type)" & theType
  22.     set gNavType = theType
  23.   end if
  24.   
  25.   go frame gNavType
  26. end setView
  27.  
  28.  
  29. on setViewPopUp
  30.   global gLabels
  31.   global gNavViewPop, gNavViews,gNavViewSelect, gCurLabelProp
  32.   global gNavViewPopList, gOpenPopMenu
  33.   
  34.   
  35.   --put ">>>setViewPopUp in _NAV"
  36.   
  37.   put value(string(gNavViews)) into temp
  38.   
  39.   --put ">>>temp in setViewPopUp" && temp
  40.   
  41.   --
  42.   --
  43.   -- Replace each item with the full value
  44.   --
  45.   repeat with i = 1 to count(temp)
  46.     set full = getAProp(gLabels, getAt(temp, i))
  47.     setAt(temp, i, getAt(full, 1))
  48.   end repeat 
  49.   
  50.   
  51.   --put ">>> pop up items: " & listToItems(temp)
  52.   
  53.   --put ">>>PopMenu objectP: " & objectP(PopMenu)
  54.   
  55.   if the machineType = 256 then
  56.     --    if objectP(gNavViewPop) then 
  57.     --      gNavViewPop(mDispose)
  58.     --    else
  59.     --      openPopMenu
  60.     --    end if
  61.     --    set gNavViewPop = PopMenu(mNew, listToItems(temp), 599)
  62.     --    gNavViewPop(mSetItemMark, 18)  
  63.     set gNavViewPop = listToItems(temp)  
  64.   else
  65.     if voidP(gOpenPopMenu) then 
  66.       openPopMenu
  67.     end if    
  68.     set gNavViewPopList = listToItems(temp)
  69.   end if
  70.   
  71.   
  72.   put getPos(gNavViews, gCurLabelProp) into gNavViewSelect
  73. end setViewPopUp
  74.  
  75. on doViewPop
  76.   --put ">>> doViewPop" 
  77.   
  78.   global gNavViewPop, gNavViewSelect, gNavViews, gNavViewPopList
  79.   global gStageLeft, gStageTop, gStageRight, gStageBottom
  80.   global gChoice, gNavPalette
  81.   
  82.   --  set hPos = the left of sprite (the clickOn) + gStageLeft + 1
  83.   --  set vPos = the top of sprite (the clickOn) + gStageTop
  84.   --  
  85.   set hPos = the left of sprite (the clickOn) 
  86.   set vPos = the bottom of sprite (the clickOn)
  87.   
  88.   --put ">>>click on, h, v" && the clickOn && hPos && vPos
  89.   
  90.   -- dmd change per paul...
  91.   --set hPos = hPos - 50
  92.   
  93.   if the machineType = 256 then
  94.     --   set choice = gNavViewPop(mPopNum, hPos, vPos, gNavViewSelect)
  95.     set r = the rect of gNavPalette
  96.     
  97.     lCloseNavPalette 1
  98.     
  99.     tell the stage to SetNavShadow(r)
  100.     
  101.     tell the stage to set gChoice = ¼
  102. doDMDPopMenu(gNavViewPop, hPos, vPos, 18, gNavViewSelect)
  103.     
  104.     tell the stage to ClearNavShadow()
  105.     
  106.     lOpenNavPalette
  107.     set choice = gChoice
  108.   else
  109.     set choice = HPopUpMenu(gNavViewPopList, gNavViewSelect, vPos, hPos)
  110.     
  111.     --put "choice = " & quote & choice & quote && stringP(choice) && integerP(choice)
  112.     if choice = 0 then exit
  113.     set choice = integer(item 3 of choice)
  114.     --put "choice = " & quote & choice & quote && stringP(choice) && integerP(choice)
  115.     
  116.   end if
  117.   
  118.   if choice > 0  and choice <> gNavViewSelect then 
  119.     set gNavViewSelect = choice
  120.     
  121.     --put ">>> doViewPop Choose: " & choice && getaProp(gNavViews, choice)
  122.     
  123.     --lCloseNavPalette
  124.     tell the stage to goGo (getaProp(gNavViews, choice))
  125.   end if
  126.   
  127. end DoViewPop
  128.  
  129. on setPhotosPopUp thePhotos
  130.   
  131.   global gNavPhotoPop, gNavPhotos,gNavPhotoSelect
  132.   global gNavPhotoPopList, gOpenPopMenu
  133.   
  134.   --put ">>>setPhotosPopUp _NAV"
  135.   
  136.   set gNavPhotos = thePhotos
  137.   
  138.   if voidP(thePhotos) then 
  139.     puppetSprite 8,TRUE
  140.     set the castNum of sprite 8 = cast "PhotosOff"
  141.     updateStage
  142.     --put ">>> disabled photos"
  143.     exit
  144.   end if
  145.   
  146.   --put ">>> enabled photos"
  147.   
  148.   puppetSprite 8, TRUE
  149.   set the castNum of sprite 8 = 34
  150.   updateStage
  151.   puppetSprite 8, FALSE
  152.   --beep
  153.   
  154.   put value(string(thePhotos)) into temp
  155.   
  156.   --
  157.   --
  158.   -- Replace each item with the full value
  159.   --
  160.   repeat with i = 1 to count(temp)
  161.     set full = getAProp(gLabels, getAt(temp, i))
  162.     setAt(temp, i, getAt(full, 1))
  163.   end repeat
  164.   
  165.   
  166.   --put ">>>PopMenu objectP: " & objectP(PopMenu)
  167.   
  168.   if the machineType = 256 then  
  169.     --    if objectP(gNavPhotoPop) then
  170.     --      gNavPhotoPop(mDispose)
  171.     --    else
  172.     --      openPopMenu
  173.     --    end if
  174.     --    set gNavPhotoPop = PopMenu(mNew,listToItems(temp),999)
  175.     --    gNavPhotoPop(mSetItemMark, 0)  
  176.     set gNavPhotoPop = listToItems(temp)  
  177.   else
  178.     if voidP(gOpenPopMenu) then 
  179.       openPopMenu
  180.     end if    
  181.     set gNavPhotoPopList = listToItems(temp)
  182.   end if
  183.   
  184.   put 0 into gNavPhotoSelect
  185.   
  186. end setPhotosPopUp
  187.  
  188. on disableHotSpots
  189.   --put ">>> disable hotspots"
  190.   
  191.   puppetSprite 7,TRUE
  192.   set the castNum of sprite 7 to cast "HotSpotsOff"  
  193.   updateStage  
  194. end
  195.  
  196. on EnableHotSpots
  197.   puppetSprite 7,FALSE
  198.   updateStage 
  199.   go to the frame
  200. end
  201.  
  202.  
  203. on doPhotoPop
  204.   global gNavPhotoPop, gNavPhotoSelect
  205.   global gStageLeft, gStageTop, gStageRight, gStageBottom
  206.   global gSuppPhoto, gNavPhotoPopList
  207.   global gChoice, gNavPalette
  208.   
  209.   --
  210.   --
  211.   -- Note that in a suplemental photo, we disable the
  212.   -- nav palette
  213.   --
  214.   
  215.   if voidP(gNavPhotos) then exit
  216.   
  217.   --  set hPos = the left of sprite (8) + gStageLeft + 1
  218.   --  set vPos = the top of sprite (8) + gStageTop
  219.   set hPos = the left of sprite (8)
  220.   set vPos = the bottom of sprite (8)
  221.   
  222.   --set hPos = hPos - 50
  223.   
  224.   
  225.   if the machineType = 256 then
  226.     --    set choice = gNavPhotoPop(mPopNum, hPos, vPos, gNavPhotoSelect)
  227.     set r = the rect of gNavPalette
  228.  
  229.     lCloseNavPalette 1
  230.     
  231.     tell the stage to SetNavShadow(r)
  232.     
  233.     tell the stage to set gChoice = ¼
  234. doDMDPopMenu(gNavPhotoPop, hPos, vPos, 18, gNavPhotoSelect)
  235.     tell the stage to ClearNavShadow(r)
  236.     
  237.     lOpenNavPalette
  238.     set choice = gChoice
  239.     
  240.   else
  241.     --    set choice = HPopUpMenu(gNavPhotoPopList, gNavPhotoSelect, vPos, hPos)
  242.     set choice = HPopUpMenu(gNavPhotoPopList, -1, vPos, hPos)
  243.     
  244.     --put "choice = " & quote & choice & quote && stringP(choice) && integerP(choice)
  245.     if choice = 0 then exit
  246.     set choice = integer(item 3 of choice)
  247.     --put "choice = " & quote & choice & quote && stringP(choice) && integerP(choice)
  248.   end if
  249.   
  250.   if choice > 0 then 
  251.     set gNavPhotoSelect = choice
  252.     
  253.     --put ">>> doPhotoPop Choose: " & choice && getaProp(gNavPhotos, choice)
  254.     
  255.     set gSuppPhoto = 1
  256.     --lCloseNavPalette
  257.     tell the stage to goGo (getaProp(gNavPhotos, choice))  
  258.   end if
  259.   
  260. end DoPopup
  261.  
  262. on listToItems theList
  263.   put empty into it
  264.   repeat with i=1 to count(theList)
  265.     put getat(theList,i) & RETURN after it
  266.   end repeat
  267.   put empty into char(length(it)) of it
  268.   if length(it) > 256 then put 0 into it
  269.   return it
  270. end listToItems
  271.  
  272. on closeWindow
  273.   --undocumented but supported
  274.   -- clear out popupXobject
  275.   --clearOutPopUp
  276. end closeWindow
  277.  
  278. on clearOutPopUp
  279.   global gNavViewPop, gNavPhotoPop
  280.   if objectP(gNavViewPop) then gNavViewPop(mDispose)
  281.   if objectP(gNavPhotoPop) then gNavPhotoPop(mDispose)
  282.   if the machineType =256 then closeXLib "PopMenu.DLL"
  283.   else closeXLib "HierPopUp.XFCN"
  284. end clearOutPopUp
  285.  
  286. on calculateStageSize
  287.   global gStageLeft, gStageTop, gStageRight, gStageBottom
  288.   if the machineType <> 256 or the stageLeft = 0 then
  289.     --Macintosh is OK, or if the stage is full-screen
  290.     set gStageLeft = the stageLeft
  291.     set gStageTop = the stageTop
  292.     set gStageRight = the stageRight
  293.     set gStageBottom = the stageBottom
  294.   else 
  295.     --PC is buggy, must make corrections
  296.     set gStageLeft = -the stageLeft -1
  297.     set gStageTop = -the stageTop - 1
  298.     set gStageRight = the stageRight + the stageLeft - gStageLeft
  299.     set gStageBottom = the stageBottom + the stageTop - gStageTop 
  300.   end if
  301. end calculateStageSize
  302.